/*
 * @lc app=leetcode.cn id=461 lang=typescript
 *
 * [461] 汉明距离
 */

// @lc code=start
function hammingDistance(x: number, y: number): number {
    return (x ^ y)
        .toString(2)
        .split("")
        .reduce((col, cur) => {
            if (cur === "1") return col + 1;
            return col;
        }, 0);
}
// @lc code=end
